home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / graphics / qpeg11c.zip / VESA.ASM < prev    next >
Assembly Source File  |  1993-11-05  |  2KB  |  72 lines

  1. ;
  2. ; QPEG video driver
  3. ; for VESA compatible graphics cards
  4. ;
  5. ; 15-Oct-93:  1st release
  6. ; 04-Nov-93:  several bugs fixed
  7. ;
  8.  
  9.         .286
  10. Code    Segment Para 'Code'
  11.         Assume  cs:Code
  12.         Org 100h
  13.  
  14. Procs   dw      Bank,Init,Exit,0
  15.  
  16. Bank:   test    cs:VesaMode,0ffh
  17.         jz      SkipIt          ; don't do bank switching if no VESA mode
  18.         pusha
  19.         push    es
  20.         push    ds
  21.         mul     cs:VesaGranularity
  22.         mov     dx,ax
  23.         push    dx
  24.         xor     bx,bx           ; window A
  25.         mov     ax,4f05h
  26.         int     10h
  27.         pop     dx
  28.         mov     bx,1            ; window B
  29.         mov     ax,4f05h
  30.         int     10h
  31.         pop     ds
  32.         pop     es
  33.         popa
  34. SkipIt: retf
  35.  
  36. VesaGranularity db 0    ; granularity of video bank address
  37. VesaMode        db 0    ; 0 = not a VESA mode (i.e. no bank switching)
  38.  
  39. Init:   mov     cs:VesaMode,0
  40.         cmp     ax,4f02h
  41.         jne     Ready           ; skip everything if no VESA mode
  42.         mov     cs:VesaMode,1
  43.         push    cx
  44.         mov     dx,cs
  45.         mov     es,dx
  46.         xor     di,di           ; es:di - VESA info table
  47.         mov     cx,bx           ; mode number
  48.         mov     ax,4f01h        ; get VESA mode info
  49.         int     10h
  50.  
  51.         mov     cx,cs:[04h]     ; VESA page granularity (in Kb)
  52.         mov     al,1
  53.         test    cx,cx
  54.         je      Gran64
  55.         mov     ax,64
  56.         div     cl
  57. Gran64: mov     cs:VesaGranularity,al
  58.  
  59.         pop     ax              ; default = minimum bytes per line
  60.         mov     cx,cs:[10h]     ; VESA bytes per line
  61.         cmp     cx,ax
  62.         jae     Ready
  63.         add     cx,cx           ; double if too small
  64. Ready:  retf
  65.  
  66. Exit:   retf
  67.  
  68. Code    Ends
  69.         End Procs
  70.  
  71. ; End of source.
  72.